﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Tressel_asm
{
    public partial class SymbolTableForm : Form
    {
        public SymbolTableForm(DataTable symbolTable)
        {
            /*!
            Procedure Name: SymbolTableForm
            Description: the constructor for the symbol table form; displays the symbol table
            Input Parameters: DataTable symbolTable
            Output Parameters: none
            Error Conditions Tested:
            Error Messages Generated:
            Original Author: Steve Rudy
            Procedure Creation Date: 10/18/2009
            Modification Log:
            Coding Standards Met: SR
            Testing Standards Met: RM
            !*/
            InitializeComponent();
            this.symbolTableDataGridView.AutoGenerateColumns = false;
            this.symbolTableDataGridView.DataSource = symbolTable;
        }

        private void SymbolTableDataGridViewSelectionChanged(object sender, EventArgs e)
        {
            /*!
            Procedure Name: SymbolTableDataGridViewSelectionChanged
            Description: blocks the user from selecting symbol table data
            Input Parameters: object sender, EventArgs e
            Output Parameters: none
            Error Conditions Tested:
            Error Messages Generated:
            Original Author: Steve Rudy
            Procedure Creation Date: 10/19/2009
            Modification Log:
            Coding Standards Met: SR
            Testing Standards Met: RM
            !*/
            foreach (DataGridViewRow row in symbolTableDataGridView.SelectedRows)
            {
                row.Selected = false;
            }
        }

        private void symbolTableDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.ColumnIndex == 1 && e.Value.ToString().Length > 0)
            {
                e.Value = TresselIntermediate.ToHex(System.Convert.ToInt16(e.Value));
            }
        }
    }
}
